package de.openlaboratory.cmis.repository;

import java.io.Serializable;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

import org.apache.chemistry.opencmis.client.api.Repository;
import org.apache.chemistry.opencmis.client.api.Session;
import org.apache.chemistry.opencmis.commons.data.AclCapabilities;
import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement;
import org.apache.chemistry.opencmis.commons.data.ExtensionFeature;
import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
import org.apache.chemistry.opencmis.commons.enums.CmisVersion;

import de.openlaboratory.cmis.core.OpenLabSession;
import de.openlaboratory.elib.core.LogManager;

public class LocalRepository
	implements Repository, ExtensionsData, RepositoryInfo, Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 31323574187810533L;
	private Path repositoryPath;

	public LocalRepository(String directoryPath)
	{
		this.repositoryPath = Paths.get(directoryPath);
	}

	@Override
	public Session createSession()
	{
		return new OpenLabSession(this);
	}
	
	/*
	 * CMIS INTERFACE METHODS
	 */

	@Override
	public AclCapabilities getAclCapabilities()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public RepositoryCapabilities getCapabilities()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean getChangesIncomplete()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<BaseTypeId> getChangesOnType()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public CmisVersion getCmisVersion()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getCmisVersionSupported()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getDescription()
	{
		// TODO Auto-generated method stub
		return "OpenLaboratory CMIS repository (local file system).";
	}

	@Override
	public List<ExtensionFeature> getExtensionFeatures()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getId()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getLatestChangeLogToken()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getName()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getPrincipalIdAnonymous()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getPrincipalIdAnyone()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getProductName()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getProductVersion()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getRootFolderId()
	{
		String absolutePath = this.repositoryPath.toAbsolutePath().toString();
		LogManager.logMessage("Local Repository - abslute path=" + absolutePath);
		
		return absolutePath;
	}

	@Override
	public String getThinClientUri()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getVendorName()
	{
		// TODO Auto-generated method stub
		return "openlaboratory.de - Open Laboratory";
	}

	@Override
	public List<CmisExtensionElement> getExtensions()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setExtensions(List<CmisExtensionElement> arg0)
	{
		// TODO Auto-generated method stub
		
	}

}
